<template>
    <div>
        <ul>
            <li v-for="(item,index) in list" :key="item.id">
                {{item.content}}<button @click="del(index)">删除</button>
            </li> 
        </ul>
    </div>
</template>

<script lang="ts">
import {defineComponent} from 'vue';

/**{
 *  id
 * content
 * }*/
export default defineComponent({
    props:{
        list:{
            type:Array,
            default:()=>[]
        }
    },
    setup(props,{emit}){
        let del = (index:number) => {
            emit('del',index)
        }
        return {
            del
        }
    }
})
</script>